package com.example.smartcity.Mappers;

import com.example.smartcity.Entity.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface NewsCommentMapper {
    @Select("select id as textid from news where title like CONCAT('%',#{textname},'%')")
    int getTextidByTextName(String textname);
    @Insert("insert into newscomment(textid,userid,comment,createtime) values(#{textid},#{userid},#{comment},#{createtime})")
    void pressComment(int textid,int userid,String comment,String createtime);
    @Select("SELECT * FROM newscomment WHERE textid=#{textid} ORDER BY commentid DESC;")
    List<Comment> getCommentByTextid(int textid);

}
